﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using Oracle.DataAccess.Client;

namespace Sweepids.Models.Object
{
    //Columns
    public class Zip
    {
        public string ZipId { get; set; }
        public string State { get; set; }
        public string City { get; set; }

        //Oracle parameters
        public List<OracleParameter> OracleParameters
        {
            get
            {
                return new List<OracleParameter>
                    {
                        new OracleParameter(":ZIP", OracleDbType.Varchar2)
                            {
                                Value = ZipId
                            },
                        new OracleParameter(":STATE", OracleDbType.Varchar2)
                            {
                                Value = State
                            },
                        new OracleParameter(":CITY", OracleDbType.Varchar2)
                            {
                                Value = City
                            }
                    };
            }
        }
         //Constructors
        public Zip()
        {
            ZipId = "";
            State = "";
            City = "";
        }

        public Zip(IDataRecord myReader)
        {
            ZipId = myReader["ZIP"] == DBNull.Value ? "" : (string) myReader["ZIP"];
            State = myReader["STATE"] == DBNull.Value ? "" : (string) myReader["STATE"];
            City = myReader["CITY"] == DBNull.Value ? "" : (string) myReader["CITY"];
        }

    }
}